package neo.app.service;

import java.util.Map;

import neo.core.common.PagingList;
import neo.core.util.MapUtil;

public class AclService extends BaseService {

	//角色列表
	private static final String SQL_GET_ALL_ACL = "select * from ken_acl";
	/**
	 * 角色列表
	 * @return
	 */
	public PagingList getAllAcl() {
		return getPagingList(SQL_GET_ALL_ACL);
	}
	
	//添加角色
	private static final String SQL_INSERT_ACL = "insert into ken_acl values(acl_id,?,?,?,?)";
	/**
	 * 添加角色
	 * @param parameters
	 * @return
	 */
	public boolean addAcl(Map map) {
		//1、获取值
		String acl_name = MapUtil.getStringFromMap(map, "acl_name");
		String acl_desc = MapUtil.getStringFromMap(map, "acl_desc");
		String acl_key = MapUtil.getStringFromMap(map, "acl_key");
		String acl_default = MapUtil.getStringFromMap(map, "acl_default");
		//2、校验数据有效性(没做)
		
		//3、sql
		//4、执行sql
		if(jt.update(SQL_INSERT_ACL, new Object[]{acl_name, acl_desc, acl_key, acl_default }) > 0){
			return true;
		}
		return false;
	}

}
